<html>

<meta charset="UTF-8">
<script type="text/javascript">
function links()
{
   var xmlhttp;
		
    if (window.XMLHttpRequest)
  	{// code for IE7+, Firefox, Chrome, Opera, Safari
 	 xmlhttp=new XMLHttpRequest();
  	}
	else
  	{// code for IE6, IE5
  	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  	}
	xmlhttp.onreadystatechange=function()
  	{
  	
  	}	
    xmlhttp.open("GET","onetest.php?state1=0",true);
    xmlhttp.send();

}
</script>

    <body>

	<div id="myDiv">
    </div>

        <button type="button" onclick="links()">开关一</button>

</body>
</html>


我现在在html 里边写一个js ajax 发送个数据到php接受 是这样使用的么？不太懂